package com.ddwl.common.feign.api;

import com.ddwl.schema.bo.base.PageBo;
import com.ddwl.schema.bo.gate.AliYunUploadBo;
import com.ddwl.schema.bo.gate.DingTalkBo;
import com.ddwl.schema.bo.gate.MobileRechargeRecordPageBo;
import com.ddwl.schema.bo.gate.RegionBo;
import com.ddwl.schema.bo.gate.byteDance.ByteOrderBo;
import com.ddwl.schema.bo.gate.byteDance.ByteRefundBo;
import com.ddwl.schema.bo.gate.kuaiDi100.QueryBo;
import com.ddwl.schema.bo.gate.wechat.WxTemplateMsgBo;
import com.ddwl.schema.vo.base.PageVo;
import com.ddwl.schema.vo.base.RestVo;
import com.ddwl.schema.vo.base.WxRestVo;
import com.ddwl.schema.vo.funds.ByteDanceOrderVo;
import com.ddwl.schema.vo.funds.ByteDanceQueryOrderVo;
import com.ddwl.schema.vo.funds.ByteDanceQueryRefundVo;
import com.ddwl.schema.vo.funds.ByteDanceRefundVo;
import com.ddwl.schema.vo.gate.MobileRechargeRecordVo;
import com.ddwl.schema.vo.gate.RegionVo;
import com.ddwl.schema.vo.gate.kuaiDi100.QueryTrackVo;
import com.ddwl.schema.vo.gate.wechat.WechatUserInfoListVo;
import com.ddwl.schema.vo.gate.wechat.WechatUserInfoVo;
import com.ddwl.schema.vo.order.StatisticsAmountVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

@FeignClient(name = "ddwl-gate", path = "/gate")
public interface GateApi {
    /**
     * 获取地址详情
     *
     * @param id
     * @return
     */
    @GetMapping("/region/get")
    RestVo<RegionVo> geoRegion(@RequestParam("id") String id);

    /**
     * 获取城市ID
     *
     * @param bo
     * @return
     */
    @PostMapping("/region/cityId")
    RestVo<String> getCityId(@RequestBody RegionBo bo);

    /**
     * 获取地址详情列表
     *
     * @param ids
     * @return
     */
    @GetMapping("/region/listByIds")
    RestVo<List<RegionVo>> listLegionByIds(@RequestParam("ids") String ids);

    /**
     * 推送微信模板消息
     *
     * @param template
     * @return
     */
    @PostMapping("/wechat/tempMessagePush")
    @ApiOperation("推送微信模板消息")
    RestVo<WxRestVo> tempMessagePush(@RequestBody WxTemplateMsgBo template);

    /**
     * 获取无限小程序码
     *
     * @param param
     * @param appId
     * @return
     */
    @GetMapping("/wechat/wxaCodeUnlimit/get")
    @ApiOperation("获取无限小程序码")
    RestVo<String> wxaCodeUnlimit(@RequestParam String param,
                                  @RequestParam String appId,
                                  @RequestParam String filePath,
                                  @RequestParam(required = false) String page);

    /**
     * 自定义logo小程序码
     *
     * @param param
     * @param appId
     * @return
     */
    @GetMapping("/wechat/wxaCodeUnlimit/customizeLogo")
    @ApiOperation("自定义logo小程序码")
    RestVo<String> customizeLogoWxaCodeUrl(@RequestParam String param,
                                           @RequestParam String appId,
                                           @RequestParam String filePath,
                                           @RequestParam String fileName,
                                           @RequestParam(required = false) String page);

    /**
     * 获取店铺小程序码
     *
     * @param param
     * @param appId
     * @param fileName
     * @return
     */
    @GetMapping("/wechat/shopWxaCode/get")
    @ApiOperation("店铺小程序码")
    RestVo<String> getShopWxaCode(@RequestParam String param, @RequestParam String appId, @RequestParam(required = false) String fileName);

    /**
     * 用户分享码
     *
     * @param param
     * @param appId
     * @return
     */
    @PostMapping("/wechat/userShareCode/get")
    @ApiOperation("获取用户分享码")
    RestVo<String> getUserShareCode(@RequestParam String param, @RequestParam String appId);

    /**
     * 阿里云上传文件
     *
     * @param uploadBo
     * @return
     */
    @PostMapping("/oss/base64Upload")
    @ApiOperation("获取无限小程序码")
    RestVo<String> base64Upload(@RequestBody AliYunUploadBo uploadBo);

    @PostMapping("/region/findByBo")
    @ApiOperation("根据省市区地址名称查询")
    RestVo<RegionVo> findRegionByBo(@RequestBody RegionBo regionBo);

    @GetMapping("/dingding/dingTalkMessageMobiles")
    @ApiOperation("钉钉推送(按电话)")
    RestVo sendDingTalkMessageMobiles(@RequestParam("message") String message, @RequestParam("mobiles") String mobiles) throws Exception;

    @GetMapping("/dingding/dingTalkMessageDept")
    @ApiOperation("钉钉推送(按部门)")
    RestVo sendDingTalkMessageDept(@RequestParam("message") String message, @RequestParam("departments") String departments) throws Exception;

    @PostMapping("/mobile/cost/page")
    @ApiOperation("后台获取手机充值记录")
    RestVo<PageVo<MobileRechargeRecordVo>> page(@RequestBody PageBo<MobileRechargeRecordPageBo> pageBo);

    @PostMapping("/mobile/cost/amount")
    @ApiOperation("后台获取手机充值金额记录")
    RestVo<List<StatisticsAmountVo>> getAmount(@RequestBody MobileRechargeRecordPageBo pageBo);

    @GetMapping("/dingding/dingTalkMessageNow")
    @ApiOperation("钉钉即时推送")
    RestVo sendDingTalkMessageNow(@RequestBody DingTalkBo pagebo) throws Exception;

    @PostMapping("/dingding/dingTalkMessageRobot")
    @ApiOperation("钉钉推送(钉钉机器人)")
    RestVo dingTalkMessage(@RequestParam("message") String message, @RequestParam("mobiles") String mobiles);

    @GetMapping("/region/geo")
    @ApiOperation("地址获取经纬度")
    RestVo<Object> geoLoc(@RequestParam(required = false) String city, @RequestParam String address);


    @GetMapping("/region/reGeo")
    @ApiOperation("根据经纬度获取地址 经度在前, ','分割")
    RestVo<Object> geoReLoc(@RequestParam(required = false) Integer radius, @RequestParam String location);

    /**
     * 生成 小程序urlscheme
     *
     * @return
     */
    @PostMapping("/wechat/generateScheme")
    @ApiOperation("生成小程序url scheme码")
    RestVo<String> generateScheme(@RequestParam String appId, @RequestParam String path, @RequestParam(required = false) String query, @RequestParam(required = false) Boolean is_expire, @RequestParam(required = false) long expire_time);

    /**
     * 获取微信公众号用户信息
     *
     * @param nextOpenId
     * @return
     */
    @GetMapping("/wechat/batchGetWxUserInfo")
    @ApiOperation("批量获取微信公众号用户信息")
    RestVo<WechatUserInfoListVo> batchGetWxUserInfo(@RequestParam(required = false) String nextOpenId);

    /**
     * 获取微信公众号用户信息
     *
     * @param openId
     * @return
     */
    @GetMapping("/wechat/getWechatUserInfo")
    @ApiOperation("获取微信公众号用户信息")
    RestVo<WechatUserInfoVo> getWechatUserInfo(@RequestParam() String openId);

    /**
     * 获取oss文件base64
     *
     * @param fileName
     * @return
     */
    @GetMapping("/wechat/getOSSBase64")
    @ApiOperation("获取oss文件base64")
    RestVo<String> getOSSBase64(@RequestParam String fileName);

    /**
     * 获取字典配置
     *
     * @param tag
     * @param field
     * @return
     */
    @ApiOperation("获取字典配置")
    @GetMapping("/dictionary/field/val")
    RestVo<String> getSettingVal(@RequestParam String tag, @RequestParam String field);

    /**
     * 获取Tag字典配置
     *
     * @param tag
     * @return
     */
    @ApiOperation("获取tag字典配置")
    @GetMapping("/dictionary/field/tag")
    RestVo<Map<String, String>> getSettingByTag(@RequestParam String tag);

    /**
     * 预下单
     *
     * @param bo
     * @return
     */
    @ApiOperation("预下单")
    @PostMapping("/byteDance/createOrder")
    RestVo<ByteDanceOrderVo> createOrder(@RequestBody ByteOrderBo bo);

    /**
     * 订单查询
     *
     * @param bo
     * @return
     */
    @ApiOperation("订单查询")
    @PostMapping("/byteDance/queryOrder")
    RestVo<ByteDanceQueryOrderVo> queryOrder(@RequestBody ByteOrderBo bo);

    /**
     * 退款
     *
     * @param bo
     * @return
     */
    @ApiOperation("退款")
    @PostMapping("/byteDance/createRefund")
    RestVo<ByteDanceRefundVo> createRefund(@RequestBody ByteRefundBo bo);


    /**
     * 查询退款
     *
     * @param bo
     * @return
     */
    @ApiOperation("查询退款")
    @PostMapping("/byteDance/queryRefund")
    RestVo<ByteDanceQueryRefundVo> queryRefund(@RequestBody ByteRefundBo bo);

    /**
     * 实时快递查询
     *
     * @param bo
     * @return
     */
    @ApiOperation("实时快递查询")
    @PostMapping("/kuaiDi100/query")
    RestVo<QueryTrackVo> queryLogistics(@Valid @RequestBody QueryBo bo);

}
